﻿<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="CopyVersionUser.aspx.vb" Inherits="CopyVersionUser" %>
<%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %>
<%@ Register Assembly="ISNet.WebUI.WebDesktop" Namespace="ISNet.WebUI.WebDesktop" TagPrefix="ISWebDesktop" %>
<%@ Register Assembly="ISNet.WebUI.WebCombo" Namespace="ISNet.WebUI.WebCombo" TagPrefix="ISWebCombo" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
 
    <script src="script/tinybox.js"></script>
    <link href="script/style.css" rel="stylesheet" />
        <script>
            function WebGrid1_OnRowContextMenu(controlId, rowType, rowElement, menuObject) {
                menuObject.Items[0].Hide();
                
                return false;
            }

            function release(Func) {
                if (confirm('กรุณายืนยันการ Release กลับ') == false) {
                    return false
                }
                //alert(id); return;
                var version = document.getElementById("<%= HdMyVersion.ClientID %>").value;
                //alert(version);
               // return false;
                var grid = ISGetObject("WebGrid1");
              
                var data = Func + "," + version;
                grid.AddInput("data", data);
                  
                    grid.SendCustomRequest();

                

                event.cancelBubble = true;
                event.returnValue = false;
            }
            function CustomRequestSearch() {
               
                var grid = ISGetObject("WebGrid1");
                grid.AddInput("type", "3");
                grid.SendCustomRequest();

                return false;
                event.cancelBubble = true;
                event.returnValue = false;

            }

            function CustomRequestCopy() {
                var version = document.getElementById("<%= HdMyVersion.ClientID %>").value;
                var txtconf = "กรุณายืนยันการ Copy Version ไปยัง Version " + version;
                if (confirm(txtconf) == false) {
                    return false;
                }

                var grid = ISGetObject("WebGrid1");
                grid.AddInput("type", "1");
                grid.SendCustomRequest();

                return false;
                event.cancelBubble = true;
                event.returnValue = false;
               
            }

            function CustomRequestCopyForce() {
                //if (confirm('Force Copy Version') == false) {
                //    return false;
                //}
                
                var grid = ISGetObject("WebGrid1");
                    grid.AddInput("type", "2");
                    grid.SendCustomRequest();

                   
                event.cancelBubble = true;
                event.returnValue = false;
                return false;
            }

            function setCause() {
               
               TINY.box.show({ url: 'CauseCopy.aspx', closejs: function () { checkCause2() } })
                //TINY.box.show({ iframe: 'CauseCopy.aspx', boxid: 'frameless', width: 500, height: 200, fixed: false, maskid: 'lightmask', maskopacity: 40, closejs: function () { checkCause() } });

               return false;
                              
            }
           
            function checkCause2() {
                //alert("checkCause2");
               // TINY.box.hide();
                var txtCause = document.getElementById('<%=HdCause.ClientID%>').value
                if (txtCause.replace(" ", "") == "") {
                   
                } else {
                    //alert(txtCause);
                    CustomRequestCopyForce();
                    document.getElementById('<%=HdCause.ClientID%>').value = "";
                }
               // return false;
               
            }
            function checkCause() { 
               // alert("dd");
                var txtCause = document.getElementById('txtAreaCause').value;
                // alert(txtCause);
                if (txtCause.replace(" ", "") == "") {
                    alert("กรุณาระบุเหตุผล");
                    return false;
                } else {
                    document.getElementById('<%=HdCause.ClientID%>').value = txtCause;

                    TINY.box.hide();
                }
                return false;
               
            }
           
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
     <br /> <br /><asp:HiddenField ID="HdMyVersion" runat="server" /><asp:HiddenField ID="HdUser" runat="server" />
<asp:HiddenField ID="HdCause" runat="server"></asp:HiddenField>
    <center>
  <div style=" width: 1000px; border: solid; border-color: gray; border-width: 1px; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 5px 5px 5px #808080; text-align: right; padding: 5px 5px 5px 5px;">
            <div style="text-align: right; margin-top: 5px;">

                <div align="left" style="width: 400px; float: left">
                    <asp:Label ID="Label1" runat="server" Text="ระบบจัดทำงบประมาณ >> จัดทำงบประมาณ >> Copy Version User"></asp:Label>
                </div>
                <div style=" position:relative; float:right;margin-right: 15px;">
                ปี&nbsp;
            <asp:TextBox ID="PlanYearsTxt" runat="server" Width="50px" Enabled="false" Style="text-align: center;"></asp:TextBox>
              </div> 
                <div style=" position:relative; float:left; clear:both;margin: 5px; top: 0px; left: 0px; width: 449px;">
                  <div style=" position:relative; float:left;">  <asp:Label ID="Label3" runat="server" Text=" User Name"></asp:Label>
                  </div>
                    <div style=" position:relative; float:left; margin-left:5px;">

                 <iswebcombo:webcombo ID="UsersWebCombo" runat="server" UseDefaultStyle="True" DataTextField="FullName" DataValueField="UserName" Height="20px" Width="300px" OnInitializeDataSource="UsersWebCombo_InitializeDataSource" AdditionalSearchFields="UserName" LayoutSettings-ResultBoxWidth="400">
                                <LayoutSettings AlwaysShowAllRowsOnDropdown="true" AlwaysShowHelpButton="false" EntryMode="AutoComplete" ComboMode="MultipleColumns">
                                    <%--       <ClientSideEvents OnAfterItemSelected="UsersWebCombo_OnAfterItemSelected" />--%>
                                    <TextSettings ParentEmptyPromptText="กรุณาเลือกชื่อผู้ใช้งาน" />
                                </LayoutSettings>
                                <Columns>
                                    <ISWebCombo:WebComboColumn BaseFieldName="UserName" Name="UserName" HeaderText="User Name" Width="150px" />
                                    <ISWebCombo:WebComboColumn BaseFieldName="FullName" Name="FullName" HeaderText="ชื่อ" Width="250px" />
                                </Columns>
                            </iswebcombo:webcombo>
                    </div>
              

                </div>
                 <div style=" position:relative; float:right;margin: 5px;">
            <a href="#" title="ค้นหา">
                <asp:ImageButton ID="SearhBtn" runat="server"  ImageUrl="Images/planIc/search.png" /></a>
                &nbsp;&nbsp;<a href="#" title="Coppy Version"><asp:ImageButton ID="coppy_btn" runat="server" OnClientClick="return CustomRequestCopy();" ImageUrl="Images/planIc/copy.png"  /></a>&nbsp;&nbsp;<asp:ImageButton ToolTip="Force Copy Version X" ID="ForceCopyBtn" runat="server" OnClientClick="return setCause();" ImageUrl="Images/planIc/forceCopy.png" Style="height: 21px" />
                &nbsp;
            </div><div style=" clear:both;"></div>
        </div></div>
</center>
      <br />
   <table style="width:100%;"><tr><td align="center">
    <div  id="div1" runat="server" style="text-align:left; width: 1000px; border: solid; border-color: gray; border-width: 1px;  -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; box-shadow: 5px 5px 5px #808080; height: 410px;">

                <div style="padding-bottom: 5px;"><strong>&nbsp;</strong></div>


                <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="350px" Width="100%" EnableTheming="True">
                    <asp:TabPanel ID="TabPanel1" runat="server" HeaderText="FundCenter">
                        <ContentTemplate>
                <ISWebGrid:WebGrid ID="WebGrid1" runat="server" UseDefaultStyle="True" Width="100%" DefaultStyleMode="Silver"  Height="350px" >
                    <LayoutSettings AllowDelete="Yes" AllowSorting="Yes" ColumnFooters="Yes" NewRowLostFocusAction="AlwaysUpdate"
                        ResetNewRowValuesOnError="False" InProgressUIBehavior="ChangeCursorToHourGlass"
                        AlwaysShowHelpButton="False" PagingMode="ClassicPaging" PagingSize="10" ColumnFooterAggregateMode="CalculateAllData"
                        VirtualLoadMode="LargeData" AllowGrouping="Yes" VirtualPageSize="10"> 
                        <RowStyle Font-Names="Tahoma" Font-Size="9pt"  CustomRules="overflow: hidden;" />
                        <AlternatingRowStyle Font-Names="Tahoma" Font-Size="9pt" BackColor="#FBFBFB"  CustomRules="overflow: hidden;" />
                        <ClientSideEvents OnRowValidate="WebGrid1_OnRowValidate"  OnRowContextMenu="WebGrid1_OnRowContextMenu" />
                    </LayoutSettings>
                    <RootTable DataKeyField="FundCenterCode" NewRowInfoText="เพิ่มรายการ">
                        <Columns>
                         <ISWebGrid:WebGridColumn Caption="FundCenter"  ColumnType="Template" Name="FundCenter" Width="350px">
                                <CellTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='' Font-Bold="True" Font-Size="Medium"></asp:Label>
                                    <asp:Image ID="Image1" runat="server" Width="16px" Height="16px" />
                                 <asp:Label ID="Label1" runat="server" Text='<%# Bind("FundCenterName")%>'></asp:Label>

                                </CellTemplate>
                            </ISWebGrid:WebGridColumn>
                       <ISWebGrid:WebGridColumn Name="version" Width="150px" DataMember="Now_version"  Caption="version" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Center" />
                            </ISWebGrid:WebGridColumn> 
                            <ISWebGrid:WebGridColumn Name="CreateDate" DataMember="CreateDate"  Width="300px" Caption="CreateDate" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <CellStyle HorizontalAlign="Center" />
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Caption=" "  ColumnType="Template" Name="Release" Width="118px">
                                <CellTemplate>
                                    <a href="#" id="<%# Eval("FundCenterCode")%>" onclick="release(id);">
                                    <asp:Image ID="Image1" ImageUrl="Images/planIc/backRelease2.png" runat="server"  /> 
                               </a>
                                </CellTemplate>
                            </ISWebGrid:WebGridColumn>
                         
                        </Columns>
                    </RootTable>
                   
                </ISWebGrid:WebGrid>

                        </ContentTemplate>
                    </asp:TabPanel>
                  
                </asp:TabContainer>
            </div>

 </td></tr></table>
     
   


     <%=AlertText %>
    <%=ScriptText %>



</asp:Content>

